using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DAL;
using BLL;
using DTO;

namespace WellmeadowsHospital
{
    public partial class frmRePortPatientCurrent : DevExpress.XtraEditors.XtraUserControl
    {
        AppointmentBLL appointmentBLL = new AppointmentBLL();
        WardBLL wardBLL = new WardBLL();
        PatientBLL patientBLL = new PatientBLL();
        ListWaitBLL listwaitBLL = new ListWaitBLL();
        BedsBLL bedsBLL = new BedsBLL();
        InPatientsBLL inpatientsBLL = new InPatientsBLL();
        public frmRePortPatientCurrent()
        {
            InitializeComponent();
            cbbWardName.DataSource = wardBLL.Select_Hoan();
            cbbWardName.DisplayMember = "WardName";
            cbbWardName.ValueMember = "WardID";
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            try
            {
                string wardid = cbbWardName.SelectedValue.ToString();
                Console.WriteLine("ma phong"+ wardid);
                gcPatient.DataSource = inpatientsBLL.Search_PatientCurrent_withWardID(wardid);
            }
            catch (Exception ee)
            {
                MessageBox.Show("error: " + ee.Message);
                gcPatient.DataSource = null;
            }
        }

        private void simpleButton2_Click(object sender, EventArgs e)
        {
            try
            {
                string wardid = cbbWardName.SelectedValue.ToString();
                Console.WriteLine(wardid);
                gcPatient.DataSource = inpatientsBLL.Search_PatientCurrent_withWardID(wardid);
                WardInfoDTO thu = wardBLL.Get_Info_Ward(wardid)[0];
                ReportPatientCurrent rp = new ReportPatientCurrent();
                rp.DataSource = inpatientsBLL.Search_PatientCurrent_withWardID(wardid);
                rp.Load(thu);
                rp.ShowPreviewDialog();

            }
            catch (Exception ee)
            {
                MessageBox.Show("error: " + ee.Message);
            }
        }

        private void cbbWardName_SelectedValueChanged(object sender, EventArgs e)
        {
            MessageBox.Show(cbbWardName.SelectedValue.ToString());
        }
    }
}
